package com.huage_03;

import java.util.Scanner;

public class String05 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要反转的字符串:");
        String s = sc.nextLine();

        String string = reverseString(s);
        System.out.println("string = " + string);
    }

    //反转字符串
    /*
         返回值类型:String
         传参:String s
     */
    public static String reverseString(String s){

        String temp = "";
        for(int i=s.length()-1;i>=0;i--){
            temp += s.charAt(i);
        }

        return temp;
    }
}
